@extends('layout')
@section('content') 
   <style> 
.modal-header-danger {
  color:#fff;
    padding:9px 15px;
    border-bottom:1px solid #eee;
    background-color: #01A9DB;
    -webkit-border-top-left-radius: 5px;
    -webkit-border-top-right-radius: 5px;
    -moz-border-radius-topleft: 5px;
    -moz-border-radius-topright: 5px;
     border-top-left-radius: 5px;
     border-top-right-radius: 5px;
}
.panel-danger > .panel-heading {
  color: #777;
  background-color: #f0ffff;
  border-color: #ddd;
}
</style>

   <div class="panel panel-danger">
      <div class="panel-heading">
      <h3><left><a href = "#"><img src="./images/inventario.png" height="75px" width="75px"></a></left>Inventario Insumo</h3>
      </div>
    </div>

 <div class="panel panel-danger">
                <div class="panel-heading">
                 <h4> <a class="glyphicon glyphicon-tasks"></a>Registro de Inventario Insumo</h4>
                </div>      
<table class="table table-striped"> 
                                <thead>
                                        <tr>
                                                <th>#</th>
                                                <th>Codigo</th>
                                                <th>Nombre</th>
                                                <th>Cantidad</th>
                                                <th>Saldo</th>
                                                <th>Observacion</th>
                                                <th>Acción</th>
                                        </tr>
                                </thead>
              @foreach($inventarioinsumos as $inventarioinsumo)
              <tr>
              <td> <strong>{{ $inventarioinsumo->id }}</strong></td>
              <td> <strong>{{ Insumo::where('id',$inventarioinsumo->id_insumo)->first()->cod_insumo }}</strong></td>
              <td> <strong>{{Insumo::where('id',$inventarioinsumo->id_insumo)->first()->nombre }}</strong></td> 
              <td> <strong>{{ $inventarioinsumo->cantidad }}</strong></td>
              <td><strong>{{  $inventarioinsumo->saldo}}</strong></td>
              <td> <strong>{{ $inventarioinsumo->observacion }}</strong></td>
              <td> <a href="inventario/{{$inventarioinsumo->id}}/edit" data-target="#editar" class="btn btn-info btn-xs" data-toggle="modal" >Editar</a></td>
              
              </tr>
              @endforeach   
</table>
        </div>

  <div class="panel panel-danger">
                <div class="panel-heading">
                        <h4><a class="glyphicon glyphicon-tasks"></a>Saldos de Insumo</h4>
                </div>      
<table class="table table-striped"> 
                                <thead>
                                        <tr>
                                                <th>#</th>
                                                <th>Codigo</th>
                                                <th>Nombre</th>
                                               <!--  <th>Saldo</th> -->
                                        </tr>
                                </thead>
              @foreach($insumos as $insumo)
              <tr>
              <td> <strong>{{ $insumo->id }}</strong></td>
              <td> <strong>{{ $insumo->cod_insumo }}</strong></td>
              <td> <strong>{{ $insumo->nombre }}</strong></td>           
              </tr>
              @endforeach
</table>
        </div>

        <button class="btn btn-primary" data-toggle="modal" data-target="#crear"><span class="glyphicon glyphicon-plus"></span> Agregar Insumo</button>
</div>

        @stop
        @section('modal')
        <!-- Comienza Crear -->
<div class="modal fade" id="crear" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div classi="modal-content">
      <div class="modal-header modal-header-danger">
        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
        <h1><i class="glyphicon glyphicon-check"></i> Agregar Insumo Al Inventario</h1>
      </div>
        <div class="modal-body">
     {{ Form::open(array('url' => 'inventario/store','method'=>'POST'),array('role'=>'form')) }}
        <p>{{Form::select('nombre',array('0' => 'Seleccione')+Insumo::lists('nombre','id'),null,array('class' => 'form-control','required'))}}</p>
         <p>{{Form::text('cantidad',null,array('class'=>'form-control','placeholder'=>"Cantidad",'required'))}}</p>
        <p>{{Form::text('observacion',null, array('class'=>'form-control','placeholder'=>"Observacion",'required'))}}</p>
        <p>{{Form::text('saldo',null, array('class'=>'form-control','placeholder'=>"Saldo",'required'))}}</textarea></p>
      </div> 
      <div class="modal-footer">
        <button type="submit" class="btn btn-warning" style="width: 30%"><span class="glyphicon glyphicon-ok-sign"></span> Guardar</button>
        <button type="button" class="btn btn-default" style="width: 30%" data-dismiss="modal"><span ></span> Regresar</button>
      </div>
    </div> 
  </div>
</div>
<!-- Fin Crear -->
<!-- Comienza Editar -->
<div class="modal fade" id="editar" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header modal-header-danger">
        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
        <h4 class="modal-title" id="myModalLabel">Editar Insumo</h4>
      </div>
        <div class="modal-body">
          
    
      </div>
      <div class="modal-footer">
         <button type="submit" class="btn btn-success" style="width: 30%"><span class="glyphicon glyphicon-ok-sign"></span> Guardar</button>
        <button type="button" class="btn btn-default" style="width: 30%" data-dismiss="modal"><span ></span> Regresar</button>
      </div>
    </div>
  </div>
</div>
<!-- Fin editar -->
<script>
   $('#crear').on('hidden.bs.modal', function () {
  document.location.reload();
})
 $('#editar').on('hidden.bs.modal', function () {
  document.location.reload();
})    
setTimeout(function() {
    $('#alerta').fadeOut('fast');
}, 2000); // <-- time in milliseconds
</script>
         @stop
</html>